1 <?php
2  session_start();
3  
if(isset($_SESSION['user']))
4  {
5
6  }
7  
else{
8   echo
"<script>location.href='login.html'</script>";
9  }
10 ?>
11 <html>
12     <head>
13         <title>Petproducts </title>
14         <style>
15   body {
16   margin:
0;
17   font-family: Arial, Helvetica, sans-serif;
18   background: #
484848;
19 }
20 .topnav {
21   overflow: hidden;
22   background-color: #f44336;
23   height: 70px;
24   border: 3px solid #ff0000;
25 }
26
27 .topnav a {
28   
float: left;
29   color: #f2f2f2;
30   text-align: center;
31   padding: 14px 16px;
32   text-decoration: none;
33   font-size: 35px;
34   font-weight: bold;
35 }
36
37 .topnav-right {
38   
float: right;
39 }
40 table {
41     font-family: arial, sans-serif;
42     border-collapse: collapse;
43     outline: #ff0000 solid 5px;
44     background: #FAFAFA;
45     width:
100%;
46     margin:5px ;
47 }
48
49 td, th {
50     border: 1px solid #dddddd;
51     text-align: left;
52     padding: 8px;
53 }
54 th{
55     background-color:#f44336;
56 }
57
58
59 .custombutton{
60   margin:25px;
61   
62 }input[type=text] {
63     width:
15%;
64     padding: 12px 20px;
65     margin: 8px ;
66     border: 2px solid red;
67     background:transparent;
68 }
69             
70     </style>
71 </head>
72 <body>
73 <div
class="topnav">
74             <a
class="active" href="home.html"><img src="ic_add_pet.png"></a>
75             <a href=
"petproducts.php">pets products</a>
76             <div
class="topnav-right">
77               <a href=
"logout.php">logout</a>
78             </div>
79           </div>
80           <div
class="custombutton">
81 <form>
82 <button style=
"height: 50px;width: 150px;cursor:pointer;border-radius:15px;
83 border: 3px solid #ff0000;background-color:#f44336;color:#f2f2f2;font-size:17px;"
formaction="productsadd.php">Add new product</button>
84 <button style=
"margin-left:900px; height: 50px;width: 150px;cursor:pointer;border-radius:15px;
85 border: 3px solid #ff0000;background-color:#f44336;color:#f2f2f2;font-size:17px;"
formaction="productupdate.php">update product</button>
86 </form>
87 </div>
88     <?php
89    
90 $con = mysqli_connect(
"localhost","root","","Petshop_management");
91 if
(!$con)
92 {
93 die(
"could not connect".mysql_error());
94 }
95 $
var=mysqli_query($con,"select * from pet_products ");
96 echo
"<table border size=10>";
97 echo
"<tr>
98 <th>pp_ID</th>
99 <th>pp_name</th>
100 <th>pp_type</th>
101 <th>cost</th>
102 <th>belongs_to</th>
103 </tr>"
;
104 if
(mysqli_num_rows($var)>0){
105     
while($arr=mysqli_fetch_row($var))
106     { echo
"<tr>
107     <td>$arr[
0]</td>
108     <td>$arr[
1]</td>
109     <td>$arr[
2]</td>
110     <td>$arr[
3]</td>
111     <td>$arr[
4]</td>
112     </tr>"
;}
113     echo
"</table>";
114     mysqli_free_result($
var);
115 }
116
117 mysqli_close($con);
118     
119     
120 ?>
121 <form action=
"deleteproducts.php" method="post">
122     <input type=
"text" name="t1" placeholder="Enter the id to delete" required >
123     <input style=
"width:75px;height:44px;cursor:pointer;border-radius:15px;
124 border: 3px solid #ff0000;background-color:#f44336;color:#f2f2f2;font-size:17px;"
type="submit" value="delete">
125 </form>
126
127 </body>
128 </html>


Gõ tìm kiếm nhanh...